package lovoStudy_9_13.Puck;

import javax.swing.*;
import java.io.File;
import java.util.ArrayList;
import java.util.List;

/**
 * Created with Intellij IDEA
 * Description:
 *
 * @ return:
 * @ author:zxl
 */
public class PuckJFrame extends JFrame {
    private ImageIcon pukeImage;
    private JLabel p;
    private JLabel p2;
    public PuckJFrame(String[] play1,String [] play2,String [] play3,String [] base){
        this.setLayout(null);
//        playerOne.toString().substring(0,playerOne.toString().length() - 1).split(",");
        //玩家一
        for (int i = 0; i < play1.length;i++){
            if (i == 0){
                pukeImage = new ImageIcon(play1[i] + ".jpg");
                 p = new JLabel(pukeImage);
                p.setBounds(200, i * 35,105,150);
            }else{
                pukeImage = new ImageIcon(play1[i].substring(1)+ ".jpg");
                p2 = new JLabel(pukeImage);
                p2.setBounds(200, i * 35,105,150);
                this.add(p2);
            }
            this.add(p);

        }
//玩家二
        for (int i = 0; i < play2.length;i++){
            if (i == 0){
                pukeImage = new ImageIcon(play2[i] + ".jpg");
                JLabel pukeLabel = new JLabel(pukeImage);
                pukeLabel.setBounds(1195,(16 - i) * 35,105,150);
                this.add(pukeLabel);
            }else{
                pukeImage = new ImageIcon(play2[i].substring(1)+ ".jpg");
                JLabel pukeLabel = new JLabel(pukeImage);
                pukeLabel.setBounds(1195,(16 - i) * 35,105,150);
                this.add(pukeLabel);
            }
        }
        //玩家三
        for (int i = 0; i < play3.length;i++){
            if (i == 0){
                pukeImage = new ImageIcon(play3[i] + ".jpg");
                JLabel pukeLabel = new JLabel(pukeImage);
                pukeLabel.setBounds(450  + (16 - i)*35,600,105,150);
                this.add(pukeLabel);
            }else{
                pukeImage = new ImageIcon(play3[i].substring(1)+ ".jpg");
                JLabel pukeLabel = new JLabel(pukeImage);
                pukeLabel.setBounds(450  + (16 - i)*35,600,105,150);
                this.add(pukeLabel);
            }
        }
        //地主牌
        for (int i = 0; i < base.length;i++){
            if (i == 0){
                pukeImage = new ImageIcon(base[i] + ".jpg");
                JLabel pukeLabel = new JLabel(pukeImage);
                pukeLabel.setBounds(600  + (3 - i) * 35,0,105,150);
                this.add(pukeLabel);
            }else{
                pukeImage = new ImageIcon(base[i].substring(1)+ ".jpg");
                JLabel pukeLabel = new JLabel(pukeImage);
                pukeLabel.setBounds(600  + (3 - i) * 35,0,105,150);
                this.add(pukeLabel);
            }
        }

        pukeImage = new ImageIcon("images\\pdd.jpg");
        JLabel pukeLabel = new JLabel(pukeImage);
        pukeLabel.setBounds(50,300,200,200);
        this.add(pukeLabel);

        pukeImage = new ImageIcon("images\\lbw.jpg");
        JLabel pukeLabel2 = new JLabel(pukeImage);
        pukeLabel2.setBounds(650,750,200,200);
        this.add(pukeLabel2);

        pukeImage = new ImageIcon("images\\dsm.jpg");
        JLabel pukeLabel3 = new JLabel(pukeImage);
        pukeLabel3.setBounds(1250,300,200,200);
        this.add(pukeLabel3);




        //设置标题图片
//        this.setIconImage(iconImage);
        //设置窗口关闭策略
        this.setDefaultCloseOperation(EXIT_ON_CLOSE);
        //设置窗口标题
        this.setTitle("欢乐斗地主");
        //设置窗口大小
        this.setSize(1500,1000);
        //设置窗口末日那个居中显示
        this.setLocationRelativeTo(null);
        //设置窗口默认可见
        this.setVisible(true);


    }





}
